<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
</head>
<body>
<div class="login_form">
    <div style="width: 50%" align="center">
        <h3 colspan="2"><font size="5">注 册</font></h3>
        <div>
            <label align="right">用户名：</label>
            <input type="text" id="username" name="username" placeholder="输入注册用户名">
        </div>

        <div>
            <label align="right">密&nbsp;&nbsp;&nbsp;码：</label>
            <label><input type="password" id="password" name="password" placeholder="输入注册密码"></label>
        </div>

        <div>
            <label align="right">文&nbsp;&nbsp;&nbsp;件：</label>
            <label><input type="file" name="username"></label>
        </div>

        <div>
            <textarea id="rich_content" name="content"></textarea>
        </div>

        <div>
            <label align="center" colspan="2">
                <input type="button" value="点击提交" id="reg"></label>
        </div>
    </div>

</div>
<script src="/static/js/jquery-1.12.4.min.js"></script>
<script src="/static/tinymce/tinymce.min.js"></script>
<script src="/static/js/tinymce_setup.js"></script>

<script>

    $("#reg").click(function () {

        username = $("#username").val();
        password = $("#password").val();
        //formdata = new FormData($("#form")[0])
        $.ajax({
            url: "/reg",
            type: "post",
            //data: formdata,
            data: {"username":username,"password":password},
            //processData: false,// 不处理数据
            //contentType: false,//不设置类型 用FormData中的类型
            success: function (data) {
                console.log(data);
                //如果登录成功 则调整到登录
                //window.location.href = "/login"
            },
            error: function (error) {
                console.log(error);
            }
        })

    })

</script>


</body>
</html>